<%@ page import="service.RainQualityService" %>
<%@ page import="service.impl.RainQualityServiceImpl" %>
<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2024/6/24
  Time: 上午 10:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("UTF-8");
    String lujin=request.getContextPath();
    RainQualityService personService =new RainQualityServiceImpl();
    String opr=request.getParameter("opr");
    if ("add".equals(opr)){
        String name=request.getParameter("name");
        String time=request.getParameter("time");
        int yu= Integer.parseInt(request.getParameter("yu"));
        String jiance  =request.getParameter("jian");
        String dizhi  =request.getParameter("dizhi");
        boolean idadd= personService.add(name,time,yu,jiance,dizhi);
        if (idadd==true){
            application.setAttribute("idadd",idadd);
            out.print("<script>alert('添加成功!');location.href='"+lujin+"/pages/index.jsp'</script>");
            return;
        }else {
            out.print("<script>alert('添加失败!');location.href='"+lujin+"/pages/index.jsp'</script>");
            return;
        }
    }
%>
</body>
</html>
